package net.hn.hnms.biz.cockpit.domain.vo;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel(value = "当年隐患排查")
public class YearHiddenTroubleVo {

    @ApiModelProperty("隐患总数")
    private Integer total;

    @ApiModelProperty("已整改隐患数量")
    private Integer rectifyCount;

    @ApiModelProperty("整改率")
    private String rectifyRate;

    @ApiModelProperty("超时未整改")
    private Integer timeoutCount;

    @ApiModelProperty("超时率")
    private String timeoutRate;

    @ApiModelProperty("重大隐患数量")
    private Integer majorDanger;

    @ApiModelProperty("重大隐患率")
    private String majorDangerRate;


    public Integer getTotal() {
        if (total == null) {
            total = 0;
        }
        return total;
    }

    public Integer getRectifyCount() {
        if (rectifyCount == null) {
            rectifyCount = 0;
        }
        return rectifyCount;
    }

    public String getRectifyRate() {
        if (total == null || rectifyCount == null) {
            rectifyRate = "0";
        } else {
            rectifyRate = String.format("%.2f", rectifyCount * 1.0 / total * 100);
        }
        return rectifyRate;
    }

    public Integer getTimeoutCount() {
        if (timeoutCount == null) {
            timeoutCount = 0;
        }
        return timeoutCount;
    }

    public String getTimeoutRate() {
        if (total == null || timeoutCount == null) {
            timeoutRate = "0";
        } else {
            timeoutRate = String.format("%.2f", timeoutCount * 1.0 / total * 100);
        }
        return timeoutRate;
    }

    public Integer getMajorDanger() {
        if (majorDanger == null) {
            majorDanger = 0;
        }
        return majorDanger;
    }

    public String getMajorDangerRate() {
        if (total == null || majorDanger == null) {
            majorDangerRate = "0";
        } else {
            majorDangerRate = String.format("%.2f", majorDanger * 1.0 / total * 100) ;
        }
        return majorDangerRate;
    }
}
